<template>
  <div :class="isPhone?'enter':'enter1'">
    <template v-if="state" >
      <img :class="isPhone?'return':'return1'" @click="enters()" src="../assets1/er/pc/syj.png" />


      <div class="_wz_xs">已观看:{{!!userData.minute ? userData.minute : 0}}分</div>
    </template>
    <template  v-else>
      <img :class="isPhone?'return':'return1'" @click="enter()" src="../assets1/er/pc/fhzy.png" />
    </template>

<!--    <img :class="isPhone?'return':'return1'" @click="enter()" src="../assets1/er/pc/fhzy.png" />-->



  </div>
</template>
<script>
export default {
  props: ["isPhone",'state'],//state true  返回上一级
  data() {
    return {
      userData:{},
      setIntervalTime:null
    }
  },
  computed: {//计算属性

  },
  beforeCreate() {//beforeCreate创建前状态

  },
  created() {//created创建完毕状态

  },
  beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

  },
  mounted() {//mounted 挂载结束状态
    let that = this;
    that.setIntervalTime = setInterval(function(){
      that.userData = JSON.parse(localStorage.getItem("userData"))
    },1000)

  },
  methods: {//执行的方法
    //返回首页
    enter() {
      let that = this;
      if (that.isPhone) {
        that.$router.replace("/");
      } else {
        that.$router.replace("/pchome");
      }
    },
    //返回首页
    enters() {
      let that = this;
      if (that.isPhone) {
        that.$router.replace("/liveList");
      } else {
        that.$router.replace("/pcliveList");
      }
    }
  },
  watch: {//监听

  },
  beforeUpdate() {//beforeUpdate 更新前状态

  },
  updated() {//updated 更新完成状态

  },
  beforeDestroy() {//beforeDestroy 销毁前状态
    clearInterval(this.setIntervalTime);
  },
  destroyed() {//destroyed 销毁完成状态

  }
}
</script>

<style scoped>
.enter {
  position: fixed;
  bottom: 2.6rem;
  right: 0;
}
.enter1 {
  position: fixed;
  bottom: 2rem;
  right: 0;
}

.return {
  width: 2.2rem;
}
.return1 {
  width: 1.6rem;
}

.enter ._wz_xs{
  padding: 0 0 0 0.3rem;
  font-size: 0.24rem;
  margin: 0.2rem 0 0 0;
  width: 2.2rem;
  height: 0.52rem;
  line-height: 0.52rem;
  color: #2b3990;
  background-image: url(../assets1/er/pc/xs.png);
  background-size: 100% 100%;
}

.enter1 ._wz_xs{
  padding: 0 0 0 20px;
  font-size: 12px;
  margin: 10px 0 0 0;
  width: 160px;height: 39px;
  line-height: 40px;
  color: #2b3990;
  background-image: url(../assets1/er/pc/xs.png);
  background-size: 100% 100%;
}
</style>
